package jp.dodododo.dao.util;

import java.util.Map;

import jp.dodododo.dao.message.Message;
import jp.dodododo.dao.paging.LimitOffset;

/**
 * 
 * @author Satoshi Kimura
 */
public abstract class DaoUtil {
	public static Map<String, Object> args(Object... map) {
		Map<String, Object> args = CollectionOfString.map(map);
		if (args.containsKey(LimitOffset.KEYWORD) == true) {
			throw new IllegalArgumentException(Message.getMessage("00017", LimitOffset.KEYWORD));
		}
		Object val = args.remove(null);
		if (val == null) {
			return args;
		}
		if (val instanceof LimitOffset) {
			args.put(LimitOffset.KEYWORD, val);
		} else {
			args.put(null, val);
		}
		return args;
	}
}
